var Rebrowser = {};
Rebrowser.extend = function(srcObj,extObj){
    for(var key in extObj){
        if(!srcObj[key])    //目标中不存在则将其补充在目标中
            srcObj[key] = extObj[key];
    }
    return srcObj;
};
Rebrowser.cache = {};

Rebrowser.search = function(name){
    //document.write("search run now " + name + " [" + (Rebrowser.cache[name] ? "in-cache" : "no-cache") + "]<br/>");
    if(!Rebrowser.cache[name]) {
        if(!Rebrowser.classes[name]) {
            throw new Error('Cannot find module \'' + name + '\' in dictionary or caches');
        }
        var currModule = Rebrowser.cache[name] = {exports:{}};
        Rebrowser.classes[name][0](function(x){
            var id = Rebrowser.classes[name][1][x];
            return Rebrowser.search(id || x);
        }, currModule, currModule.exports);
    }
    return Rebrowser.cache[name].exports;
};
